﻿#include "QStackedFrameBase.h"
#include "QStackedManageBase.h"
QStackedFrameBase::QStackedFrameBase(QStackedManageBase *parent) : QWidgetBase(parent)
{
	m_ManageBase = parent;
}

QStackedFrameBase::~QStackedFrameBase()
{
	
}

// 显示帧视图
QStackedFrameBase* QStackedFrameBase::showFrameLayout(QString layout)
{
	if(m_ManageBase != nullptr) {
		return m_ManageBase->showFrameLayout(layout);
	} else {
		qDebug("m_ManageBase is null");
	}
	return nullptr;
}

// 删除帧视图
bool QStackedFrameBase::deleteFrameLayout(QString layout,QString frameLayout)
{
	if(m_ManageBase != nullptr) {
		return m_ManageBase->deleteFrameLayout(layout, frameLayout);
	} else {
		qDebug("m_ManageBase is null");
	}
	return false;

}

// 添加帧视图
void QStackedFrameBase::addFrameLayout(QString layout,QStackedFrameBase *frameLayout)
{
	if(m_ManageBase != nullptr) {
		m_ManageBase->addFrameLayout(layout,frameLayout);
	} else {
		qDebug("m_ManageBase is null");
	}
}

// 判断视图是否存在
bool  QStackedFrameBase::isFrameLayoutExist(QString layout)
{
	if(m_ManageBase != nullptr) {
		return m_ManageBase->isFrameLayoutExist(layout);
	} else {
		qDebug("m_ManageBase is null");
		return false;
	}
}


// 获取页面超时（默认不超时）
int QStackedFrameBase::getTimeOut()
{
	return -1;
}

// 重置超时
void QStackedFrameBase::timeReset()
{
	if(m_ManageBase != nullptr) {
		m_ManageBase->timerStart(getTimeOut() * 1000);
	} else {
		qDebug("m_ManageBase is null");
	}
}

// 停止定时器
void QStackedFrameBase::timeStop()
{
	if(m_ManageBase != nullptr) {
		m_ManageBase->timerStop();
	} else {
		qDebug("m_ManageBase is null");
	}
}

// 超时回调
void QStackedFrameBase::timeOutHander()
{
	qDebug("timeOutHander");
}
